package org.ttitfly.workflow.engine;

import org.ttitfly.workflow.engine.mode.Decision;
import org.ttitfly.workflow.engine.mode.Discriminator;
import org.ttitfly.workflow.engine.mode.Fork;
import org.ttitfly.workflow.engine.mode.Join;

/**
 * 虚运行单元，通常不执行任务作业，维持流程运转需要
 * 
 * @author 潘海春
 * @version 2009-9-18
 * @see Decision
 * @see Discriminator
 * @see Fork
 * @see Join
 */
public abstract class VirtualRunUnit implements RunUnit {

	/**
	 * 流程
	 */
	protected Process parent;

	/**
	 * 名称
	 */
	private String name;

	/**
	 * 构造函数
	 * 
	 * @param parent
	 * @param name
	 */
	public VirtualRunUnit(Process parent, String name) {
		if (parent == null) {
			throw new IllegalArgumentException(
					"argument parent can not be null!");
		}
		if (name == null || "".equals(name = name.trim())) {
			throw new IllegalArgumentException(
					"argument name can not be empty string!");
		}
		this.parent = parent;
		this.name = name;
	}

	@Override
	public String getName() {
		return name;
	}

}
